#
# elasticsearch-6 5.15.2
# Dependyce JDK8
#

FROM yi/centos7-jdk8u151
MAINTAINER zezhong.shang <1044732267@qq.com>
ADD elasticsearch-6.2.4.tar.gz /usr/local/
ADD elasticsearch-analysis-ik-6.2.4.zip /usr/local/
COPY elasticsearch.yml /usr/local/elasticsearch-6.2.4/config/

# Install libs
WORKDIR /usr/local/
RUN groupadd elsearch
RUN useradd elsearch -g elsearch -p elasticsearch
RUN unzip /usr/local/elasticsearch-analysis-ik-6.2.4.zip
RUN chown -R elsearch:elsearch  elasticsearch-6.2.4
RUN chown -R elsearch:elsearch /usr/bin/supervisord
RUN touch /usr/local/supervisord.log
RUN chown -R elsearch:elsearch /usr/local/supervisord.log
RUN mkdir -p /usr/local/elasticsearch-6.2.4/plugins/analysis-ik/
RUN cp -r /usr/local/elasticsearch/* /usr/local/elasticsearch-6.2.4/plugins/analysis-ik/

USER elsearch

EXPOSE 9200
EXPOSE 9300

COPY supervisord.conf /etc/supervisord.conf
CMD ["/usr/bin/supervisord"]